1. Field of the Invention
The present invention relates generally to the field of transaction processing, a communication protocol (known as two-phase commit) is used to coordinate transactions.
2. Description of the Related Art
FIG. 1 is a block diagram of a transaction processing system 100, wherein a first data processing system 105 comprises an owning application 110 and a second data processing system 115 comprising a transaction coordinator 120 for executing transactions. There is also shown a third data processing system 130 comprising a first resource manager 135 for managing a first resource (e.g. a database). There is also shown a fourth data processing system 140 comprising a second resource manager 145 for managing a second resource (e.g. a database).
The system 100 also comprises a first log, a second log and a third log 125, 150 and 155 to which the transaction coordinator 120, the first resource manager 135 and the second resource manager 145 can respectively write one or more log records (i.e. wherein a log record comprises data associated with a transaction.
When an application wishes to “commit” a transaction, the transaction coordinator 120 requests each resource manager involved in the transaction to “prepare”.
Following preparation, each resource manager responds to the transaction coordinator that they have prepared to commit the transaction and responsive to receiving the responses, the transaction coordinator 120 asks each of the resource managers to commit the transaction. In response to committing the transaction, each resource manager reports back to the transaction coordinator 120 which subsequently records the transaction as committed.
If a resource manager fails to respond positively to the prepare request, the transaction coordinator 120 issues a “roll-back” decision to the remaining resource managers. In response to rolling back the transaction, each resource manager reports back to the transaction coordinator 120 which subsequently records the transaction as rolled-back.
Upon receipt of the resolution decision (i.e. commit or rollback) from the coordinator a resource manager has to log the decision for its own recovery purposes and it must also commit or rollback the changes made to associated resources.
It should be understood that when a transaction is between the “prepare” phase and the “commit” or “roll-back” phase, it is known as “in-doubt”.
In environments today, resource managers can be grouped and freely interchangeable such that one resource manager can take over responsibilities of another resource manager in the group. Such an environment allows for high availability in the event of failure of e.g. the another resource manager and also allows for load balancing between multiple resource managers as there can be two or more resource managers which could each perform the work required by a transaction.
In such an environment, there is a need for a mechanism to resolve transactions quickly; without data loss and without requiring significant changes to the transaction processing system.
U.S. Patent Publication No. 20080235295, Ser. No. 11/723,274, discloses a system, wherein recovery of inflowed transactions is provided by any instance in a cluster, along with peer recovery of transactions in a cluster, and administrative functionality related to these aspects. A method of managing transaction processing comprises performing transaction processing using a first process, wherein the first process logs the transaction processing that it performs, detecting failure of the first process, wherein the transaction logs of the first process are locked, taking ownership of the locked transaction logs of the first process at a second process, unlocking the locked transaction logs of the first process for use by the second process, and recovering at least one transaction using the transaction logs.